package com.talent.codes.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import com.talent.codes.filter.LocalAdminFilter;

@Configuration
public class WebMvcConfig {

    /**
     * admin过滤拦截器
     */
    @Bean
    public FilterRegistrationBean webAdminFilterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setName("webAuthFilter");
        filterRegistrationBean.setFilter(new LocalAdminFilter());
        filterRegistrationBean.setOrder(0);
        filterRegistrationBean.addUrlPatterns("/*");
        return filterRegistrationBean;
    }

}
